<template>
  <el-form label-width="100px" :model="form" :inline="inline">
    <el-form-item v-for="item in labels" :key="item.label" :label="item.label">
      <el-input v-if="item.type==='input'" 
        :placeholder="'请输入' + item.label + form[item.model]"
        v-model="form[item.model]"
      >
      </el-input>
      <el-switch v-if="item.type==='switch'" v-model="form[item.model]"></el-switch>
      <el-date-picker 
        v-if="item.type==='date'"
        type="date"
        placeholder="选择日期"
        v-model="form[item.model]"
      ></el-date-picker>
      <el-select
        v-if="item.type==='select'"
        placeholder="请选择"
        v-model="form[item.model]"
      >
        <el-option
          v-for="o in item.opts"
          :key="o.value"
          :label="o.label"
          :value="o.value"
        ></el-option>
      </el-select>
    </el-form-item>
    <el-form-item><slot></slot></el-form-item>
  </el-form>
</template>
<script setup lang="ts">

defineProps({
  labels: Array,
  form: Object,
  inline: Boolean,
})

</script>
<style lang="less" scoped>
  
</style>